<#include "../common/head.ftl" />
<!DOCTYPE html>
<html>
	<head lang="en">
	<@comme_head/>
    <@comme_map />
    <meta charset="UTF-8">
    <title>全国园所信息统计地图</title>
</head>
<body>
<@comme_header />
<div class="main clearfix" id="main">
	<@comme_daohang />
    <div class="right-content">
        <div class="content">
            <div id="echart" style="width:900px;height:600px; margin:20px auto"></div>
        </div>
    </div>
</div>
<script>


window.onload=function(){
	var resList =${resList!};
	var timeList = ${timeList!};
	
	var resYuansuo = [{name: '北京',value: '0' },
                    {name: '天津',value: '0' },
                    {name: '上海',value: '0' },
                    {name: '重庆',value: '0' },
                    {name: '河北',value: '0' },
                    {name: '河南',value: '0' },
                    {name: '云南',value: '0' },
                    {name: '辽宁',value: '0' },
                    {name: '黑龙江',value: '0' },
                    {name: '湖南',value: '0' },
                    {name: '安徽',value: '0' },
                    {name: '山东',value: '0' },
                    {name: '新疆',value: '0' },
                    {name: '江苏',value: '0' },
                    {name: '浙江',value: '0' },
                    {name: '江西',value: '0' },
                    {name: '湖北',value: '0' },
                    {name: '广西',value: '0' },
                    {name: '甘肃',value: '0' },
                    {name: '山西',value: '0' },
                    {name: '内蒙古',value: '0' },
                    {name: '陕西',value: '0' },
                    {name: '吉林',value: '0' },
                    {name: '福建',value: '0' },
                    {name: '贵州',value: '0' },
                    {name: '广东',value: '0' },
                    {name: '青海',value: '0' },
                    {name: '西藏',value: '0' },
                    {name: '四川',value: '0' },
                    {name: '宁夏',value: '0' },
                    {name: '海南',value: '0' },
                    {name: '台湾',value: '0' },
                    {name: '香港',value: '0' },
                    {name: '澳门',value: '0' }];
                    
                    
   var resJiaoshi = [{name: '北京',value: '0' },
                    {name: '天津',value: '0' },
                    {name: '上海',value: '0' },
                    {name: '重庆',value: '0' },
                    {name: '河北',value: '0' },
                    {name: '河南',value: '0' },
                    {name: '云南',value: '0' },
                    {name: '辽宁',value: '0' },
                    {name: '黑龙江',value: '0' },
                    {name: '湖南',value: '0' },
                    {name: '安徽',value: '0' },
                    {name: '山东',value: '0' },
                    {name: '新疆',value: '0' },
                    {name: '江苏',value: '0' },
                    {name: '浙江',value: '0' },
                    {name: '江西',value: '0' },
                    {name: '湖北',value: '0' },
                    {name: '广西',value: '0' },
                    {name: '甘肃',value: '0' },
                    {name: '山西',value: '0' },
                    {name: '内蒙古',value: '0' },
                    {name: '陕西',value: '0' },
                    {name: '吉林',value: '0' },
                    {name: '福建',value: '0' },
                    {name: '贵州',value: '0' },
                    {name: '广东',value: '0' },
                    {name: '青海',value: '0' },
                    {name: '西藏',value: '0' },
                    {name: '四川',value: '0' },
                    {name: '宁夏',value: '0' },
                    {name: '海南',value: '0' },
                    {name: '台湾',value: '0' },
                    {name: '香港',value: '0' },
                    {name: '澳门',value: '0' }];
   var resXuesheng = [{name: '北京',value: '0' },
                    {name: '天津',value: '0' },
                    {name: '上海',value: '0' },
                    {name: '重庆',value: '0' },
                    {name: '河北',value: '0' },
                    {name: '河南',value: '0' },
                    {name: '云南',value: '0' },
                    {name: '辽宁',value: '0' },
                    {name: '黑龙江',value: '0' },
                    {name: '湖南',value: '0' },
                    {name: '安徽',value: '0' },
                    {name: '山东',value: '0' },
                    {name: '新疆',value: '0' },
                    {name: '江苏',value: '0' },
                    {name: '浙江',value: '0' },
                    {name: '江西',value: '0' },
                    {name: '湖北',value: '0' },
                    {name: '广西',value: '0' },
                    {name: '甘肃',value: '0' },
                    {name: '山西',value: '0' },
                    {name: '内蒙古',value: '0' },
                    {name: '陕西',value: '0' },
                    {name: '吉林',value: '0' },
                    {name: '福建',value: '0' },
                    {name: '贵州',value: '0' },
                    {name: '广东',value: '0' },
                    {name: '青海',value: '0' },
                    {name: '西藏',value: '0' },
                    {name: '四川',value: '0' },
                    {name: '宁夏',value: '0' },
                    {name: '海南',value: '0' },
                    {name: '台湾',value: '0' },
                    {name: '香港',value: '0' },
                    {name: '澳门',value: '0' }];
                    
	 var resTimeList = [{name: '北京',value: '0' },
                    {name: '天津',value: '0' },
                    {name: '上海',value: '0' },
                    {name: '重庆',value: '0' },
                    {name: '河北',value: '0' },
                    {name: '河南',value: '0' },
                    {name: '云南',value: '0' },
                    {name: '辽宁',value: '0' },
                    {name: '黑龙江',value: '0' },
                    {name: '湖南',value: '0' },
                    {name: '安徽',value: '0' },
                    {name: '山东',value: '0' },
                    {name: '新疆',value: '0' },
                    {name: '江苏',value: '0' },
                    {name: '浙江',value: '0' },
                    {name: '江西',value: '0' },
                    {name: '湖北',value: '0' },
                    {name: '广西',value: '0' },
                    {name: '甘肃',value: '0' },
                    {name: '山西',value: '0' },
                    {name: '内蒙古',value: '0' },
                    {name: '陕西',value: '0' },
                    {name: '吉林',value: '0' },
                    {name: '福建',value: '0' },
                    {name: '贵州',value: '0' },
                    {name: '广东',value: '0' },
                    {name: '青海',value: '0' },
                    {name: '西藏',value: '0' },
                    {name: '四川',value: '0' },
                    {name: '宁夏',value: '0' },
                    {name: '海南',value: '0' },
                    {name: '台湾',value: '0' },
                    {name: '香港',value: '0' },
                    {name: '澳门',value: '0' }];
                    
    var	area_name,
    	index;
                    
    function getResYuansuo (){
    	if(resList==null){
    		return;
    	}
    	for(var i =0;i<resYuansuo.length;i++){
    		resYuansuo[i].value=0;
    		//console.log("resYuansuo:"+resYuansuo[i])
    		for(var j= 0; j<resList.length;j++){
    			//console.log("resList:"+resList[j])
    			area_name = resList[j].area_name;
    			resYuansuoName = resYuansuo[i].name;
    			//console.log("resYuansuoName"+resYuansuoName)
    			//console.log("area_name:"+area_name)
    			index = area_name.indexOf(resYuansuoName)
    			//console.log("index"+index)
    			if(index>-1){
    				resYuansuo[i].value = resList[j].principal_sum;
    			}
    			
    		}    		 	
    	}
    }          
                     
   
	
	function getResJiaoshi (){
	 	if(resList==null){
    		return;
    	}
    	for(var i =0;i<resJiaoshi.length;i++){
    		resJiaoshi[i].value=0;
    		//console.log("resJiaoshi:"+resJiaoshi[i])
    		for(var j= 0; j<resList.length;j++){
    			//console.log("resList:"+resList[j])
    			area_name = resList[j].area_name;
    			resJiaoshiName = resJiaoshi[i].name;
    			//console.log("resJiaoshiName"+resJiaoshiName)
    			//console.log("area_name:"+area_name)
    			index = area_name.indexOf(resJiaoshiName)
    			//console.log("index"+index)
    			//console.log(resList[j].teacher_sum)
    			if(index>-1){
    				resJiaoshi[i].value = resList[j].teacher_sum;
    			}
    			
    		}    		 	
    	}
	 }
	 function getResXuesheng (){
	 	if(resList==null){
    		return;
    	}
    	for(var i =0;i<resXuesheng.length;i++){
    		resXuesheng[i].value=0;
    		//console.log("resXuesheng:"+resXuesheng[i])
    		for(var j= 0; j<resList.length;j++){
    			//console.log("resList:"+resList[j])
    			area_name = resList[j].area_name;
    			resXueshengName = resXuesheng[i].name;
    			//console.log("resXueshengName"+resXueshengName)
    			//console.log("area_name:"+area_name)
    			index = area_name.indexOf(resXueshengName)
    			//console.log("index"+index)
    			if(index>-1){
    				resXuesheng[i].value = resList[j].student_sum;
    			}
    			
    		}    		 	
    	}
	 }
	 


	 function getTimeList (){
	 
	 
	 	if(timeList==null){
    		return;
    	}
    	for(var i =0;i<resTimeList.length;i++){
    		resTimeList[i].value=0;
    		for(var j= 0; j<timeList.length;j++){
    			//console.log("timeList:"+timeList[j])
    			area_name = timeList[j].area_name;
    			resTimeListName = resTimeList[i].name;
    			index = area_name.indexOf(resTimeListName);
    			if(index>-1){
    			console.log(timeList[j].all_time)
    				resTimeList[i].value = timeList[j].all_time;
    			}
    			
    		}    		 	
    	}
	 }	 
	 
	 
	 
	getResYuansuo();
	getResJiaoshi();
	getResXuesheng();
    getTimeList();
	
	
	
	
	
	
	
	
	
	
	
	
	

    var myChart = echarts.init(document.getElementById("echart"));
    function randomData() {
        return Math.round(Math.random()*160);
    }
    var option = {
        title: {
            text: '全国园所统计表',
            left: 'center'
        },
        tooltip: { //鼠标停留的悬浮框
            trigger: 'item',
            formatter: function(params) {
                var res = params.name;
                var myseries = option.series;
                for (var i = 0; i < myseries.length; i++) {
                    res += '<br/>' + myseries[i].name + '：';
                    //console.log(myseries[i].data[1]);
                    for(var j = 0;j<myseries[i].data.length;j++){
                        if(myseries[i].data[j].name == params.name ){
                            res += myseries[i].data[j].value;
                        }
                    }
                }
                return res;
            }
        },
        legend: {                 //图例模块
            orient: 'vertical',  //所有的图例是水平/垂直，默认‘horizontal’是水平的。
            left: 'left',
            //data:['园所总数量','公立数量','私立数量','代理销售数量','内部销售数量','教师数量','家长(学生)数量','园所总在线时间(分)']//图例的内容
            data:['园所总数量','教师数量','家长(学生)数量','园所总在线时间(分)']//图例的内容
        },
        color: [
            '#ff5e3a', '#6A6AFF', '#8fd239', '#7f8ede', '#4ac7b6', '#91d23e', '#ff5e3a', '#ff9500', '#1798d1', '#84adc2', '#e36df8'
        ],
        visualMap: {//值域条
            show: false,
            max: 1000,
            min: 0,
            left: 'left',
            inRange: {
                //color:['#16b5e5','#a5ddee']
                color: [
                    '#ff5e3a', '#6A6AFF', '#8fd239', '#7f8ede', '#4ac7b6', '#91d23e', '#ff5e3a', '#ff9500', '#1798d1', '#84adc2', '#e36df8'
                ]
            },
            top: 'bottom',
            text: ['高','低'],           // 文本，默认为数值文本
            calculable: true            //在值域条上是否能拖拽
        },
        series: [                       //系列列表，不同类型通过type指定
            {
                name: '园所总数量',        //系列名称，悬浮框和图标会与其有联系
                type: 'map',            //指定类型
                symbol: 'none',
                mapType: 'china',       //按照自己的需要下载的地图
                roam: false,            //是否开启鼠标缩放和拖拽
                label: {                //图形上的文本标签
                    normal: {           //普通情况下
                        show: true      //是否显示（还有个'textStyle:{}'可以设置文本样式）
                    },
                    emphasis: {         //高亮情况下
                        show: true      //是否显示（还有个'textStyle:{}'可以设置文本样式）
                    }
                },
                showLegendSymbol:false,
                data:resYuansuo,
                itemStyle:{
                    normal:{
                        //color:'pink'
                    },
                    emphasis:{
                        areaColor:'pink'
                    }
                }
            },
            /*
            {
                name: '公立数量',
                type: 'map',
                mapType: 'china',
                label: {
                    normal: {
                        show: true
                    },
                    emphasis: {
                        show: true
                    }
                },
                showLegendSymbol:false,
                data:[
                    {name: '北京',value: randomData() },//键值对形式
                    {name: '天津',value: randomData() },
                    {name: '上海',value: randomData() },
                    {name: '重庆',value: randomData() },
                    {name: '河北',value: randomData() },
                    {name: '河南',value: randomData() },
                    {name: '云南',value: randomData() },
                    {name: '辽宁',value: randomData() },
                    {name: '黑龙江',value: randomData() },
                    {name: '湖南',value: randomData() },
                    {name: '安徽',value: randomData() },
                    {name: '山东',value: randomData() },
                   // {name: '新疆',value: randomData() },
                    {name: '江苏',value: randomData() },
                    {name: '浙江',value: randomData() },
                    {name: '江西',value: randomData() },
                    {name: '湖北',value: randomData() },
                    {name: '广西',value: randomData() },
                    {name: '甘肃',value: randomData() },
                    {name: '山西',value: randomData() },
                    {name: '内蒙古',value: randomData() },
                    {name: '陕西',value: randomData() },
                    {name: '吉林',value: randomData() },
                    {name: '福建',value: randomData() },
                    {name: '贵州',value: randomData() },
                    {name: '广东',value: randomData() },
                    {name: '青海',value: randomData() },
                    {name: '西藏',value: randomData() },
                    {name: '四川',value: randomData() },
                    {name: '宁夏',value: randomData() },
                    {name: '海南',value: randomData() },
                    {name: '台湾',value: randomData() },
                    {name: '香港',value: randomData() },
                    {name: '澳门',value: randomData() }
                ]
            },
            
            {
                name: '私立数量',
                type: 'map',
                mapType: 'china',
                label: {
                    normal: {
                        show: true
                    },
                    emphasis: {
                        show: true
                    }
                },
                showLegendSymbol:false,
                data:[
                    {name: '北京',value: randomData() },//键值对形式
                    {name: '天津',value: randomData() },
                    {name: '上海',value: randomData() },
                    {name: '重庆',value: randomData() },
                    {name: '河北',value: randomData() },
                    {name: '河南',value: randomData() },
                    {name: '云南',value: randomData() },
                    {name: '辽宁',value: randomData() },
                    {name: '黑龙江',value: randomData() },
                    {name: '湖南',value: randomData() },
                    {name: '安徽',value: randomData() },
                    {name: '山东',value: randomData() },
                   // {name: '新疆',value: randomData() },
                    {name: '江苏',value: randomData() },
                    {name: '浙江',value: randomData() },
                    {name: '江西',value: randomData() },
                    {name: '湖北',value: randomData() },
                    {name: '广西',value: randomData() },
                    {name: '甘肃',value: randomData() },
                    {name: '山西',value: randomData() },
                    {name: '内蒙古',value: randomData() },
                    {name: '陕西',value: randomData() },
                    {name: '吉林',value: randomData() },
                    {name: '福建',value: randomData() },
                    {name: '贵州',value: randomData() },
                    {name: '广东',value: randomData() },
                    {name: '青海',value: randomData() },
                    {name: '西藏',value: randomData() },
                    {name: '四川',value: randomData() },
                    {name: '宁夏',value: randomData() },
                    {name: '海南',value: randomData() },
                    {name: '台湾',value: randomData() },
                    {name: '香港',value: randomData() },
                    {name: '澳门',value: randomData() }
                ]
            },
            {
                name: '代理销售数量',
                type: 'map',
                mapType: 'china',
                label: {
                    normal: {
                        show: true
                    },
                    emphasis: {
                        show: true
                    }
                },
                showLegendSymbol:false,
                data:[
                    {name: '北京',value: randomData() },//键值对形式
                    {name: '天津',value: randomData() },
                    {name: '上海',value: randomData() },
                    {name: '重庆',value: randomData() },
                    {name: '河北',value: randomData() },
                    {name: '河南',value: randomData() },
                    {name: '云南',value: randomData() },
                    {name: '辽宁',value: randomData() },
                    {name: '黑龙江',value: randomData() },
                    {name: '湖南',value: randomData() },
                    {name: '安徽',value: randomData() },
                    {name: '山东',value: randomData() },
                  //  {name: '新疆',value: randomData() },
                    {name: '江苏',value: randomData() },
                    {name: '浙江',value: randomData() },
                    {name: '江西',value: randomData() },
                    {name: '湖北',value: randomData() },
                    {name: '广西',value: randomData() },
                    {name: '甘肃',value: randomData() },
                    {name: '山西',value: randomData() },
                    {name: '内蒙古',value: randomData() },
                    {name: '陕西',value: randomData() },
                    {name: '吉林',value: randomData() },
                    {name: '福建',value: randomData() },
                    {name: '贵州',value: randomData() },
                    {name: '广东',value: randomData() },
                    {name: '青海',value: randomData() },
                    {name: '西藏',value: randomData() },
                    {name: '四川',value: randomData() },
                    {name: '宁夏',value: randomData() },
                    {name: '海南',value: randomData() },
                    {name: '台湾',value: randomData() },
                    {name: '香港',value: randomData() },
                    {name: '澳门',value: randomData() }
                ]
            },
            {
                name: '内部销售数量',
                type: 'map',
                mapType: 'china',
                label: {
                    normal: {
                        show: true
                    },
                    emphasis: {
                        show: true
                    }
                },
                showLegendSymbol:false,
                data:[
                    {name: '北京',value: randomData() },//键值对形式
                    {name: '天津',value: randomData() },
                    {name: '上海',value: randomData() },
                    {name: '重庆',value: randomData() },
                    {name: '河北',value: randomData() },
                    {name: '河南',value: randomData() },
                    {name: '云南',value: randomData() },
                    {name: '辽宁',value: randomData() },
                    {name: '黑龙江',value: randomData() },
                    {name: '湖南',value: randomData() },
                    {name: '安徽',value: randomData() },
                    {name: '山东',value: randomData() },
                    {name: '新疆',value: randomData() },
                    {name: '江苏',value: randomData() },
                    {name: '浙江',value: randomData() },
                    {name: '江西',value: randomData() },
                    {name: '湖北',value: randomData() },
                    {name: '广西',value: randomData() },
                    {name: '甘肃',value: randomData() },
                    {name: '山西',value: randomData() },
                    {name: '内蒙古',value: randomData() },
                    {name: '陕西',value: randomData() },
                    {name: '吉林',value: randomData() },
                    {name: '福建',value: randomData() },
                    {name: '贵州',value: randomData() },
                    {name: '广东',value: randomData() },
                    {name: '青海',value: randomData() },
                    {name: '西藏',value: randomData() },
                    {name: '四川',value: randomData() },
                    {name: '宁夏',value: randomData() },
                    {name: '海南',value: randomData() },
                    {name: '台湾',value: randomData() },
                    {name: '香港',value: randomData() },
                    {name: '澳门',value: randomData() }
                ]
            },*/
            {
                name: '教师数量',
                type: 'map',
                mapType: 'china',
                label: {
                    normal: {
                        show: true
                    },
                    emphasis: {
                        show: true
                    }
                },
                showLegendSymbol:false,
                data:resJiaoshi
            },
            {
                name: '家长(学生)数量',
                type: 'map',
                mapType: 'china',
                label: {
                    normal: {
                        show: true
                    },
                    emphasis: {
                        show: true
                    }
                },
                showLegendSymbol:false,
                data:resXuesheng
            },
            {
                name: '园所总在线时间(分)',
                type: 'map',
                mapType: 'china',
                label: {
                    normal: {
                        show: true
                    },
                    emphasis: {
                        show: true
                    }
                },
                showLegendSymbol:false,
                data:resTimeList
            }
        ]
    };
    myChart.setOption(option);
};
</script>
</body>
</html>